package com.hgw.Demo03_InterpreterPattern.examples;

/**
 * Data time:2021/12/17 19:31
 * StudentID:2019112118
 * Author:hgw
 * Description: 简单句子结点类，充当非终结符表达式角色
 */
public class SentenceNode extends AbstractNode{
    private AbstractNode direction;
    private AbstractNode action;
    private AbstractNode distance;

    public SentenceNode(AbstractNode direction, AbstractNode action, AbstractNode distance) {
        this.direction = direction;
        this.action = action;
        this.distance = distance;
    }

    // 简单句子的解释操作
    @Override
    public String interpret() {
        return direction.interpret() + action.interpret() + direction.interpret();
    }
}
